<?php
// 检测token是否正确

$str = fn_post('basic');
$json = array('status' => 'error', 'msg' => '', 'data' => 'login-fail');

if (!$str) {
	$json['msg'] = '请登录后使用';
	$json['data'] = 'login-fail';
	$this->json_encode_encrypt($json);
}

if (!($basic = json_decode($str, 1))) {
	$json['msg'] = '请登录错误,请重新登录';
	$json['data'] = 'login-fail';
	$this->json_encode_encrypt($json);
}

if (!$basic['token'] || !$basic['uid']) {
	$json['msg'] = '请登录后使用';
	$json['data'] = 'login-fail';
	$this->json_encode_encrypt($json);
}

if (!password_verify($basic['uid'] . $this->website['safe']['key'] . date('Y'), $basic['token'])) {
	$json['msg'] = '密码失效！';
	$json['data'] = 'login-fail';
	$this->json_encode_encrypt($json);
}
